#define _CRT_SECURE_NO_WARNINGS	

/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     struct TreeNode *left;
 *     struct TreeNode *right;
 * };
 */
/**
 * Note: The returned array must be malloced, assume caller calls free().
 */

typedef struct TreeNode TreeNode;

int Count_Tree_Node(TreeNode*root)
{
    if(!root)
        return 0;

    return 1+Count_Tree_Node(root->left)+Count_Tree_Node(root->right);
}

void Inorder(TreeNode*root,int*arr,int*i)
{
    if(!root)
        return;
    Inorder(root->left,arr,i);
    arr[*i]=root->val;
    (*i)++;
    Inorder(root->right,arr,i);
}

int* inorderTraversal(struct TreeNode* root, int* returnSize) 
{
    int*arr=(int*)malloc(110*4);

    int i=0;
    Inorder(root,arr,&i);

    *returnSize=Count_Tree_Node(root);

    return arr;       
}